package com.honeywell.iotserver.repository;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.honeywell.iotserver.entity.Camera;

@Repository
public interface DeviceRepository extends JpaRepository<Camera, String> {

	@Modifying
	@Transactional
	@Query(value = "update t_camera set config_status=?2 where uuid=?1 ", nativeQuery = true)
	public void updateConfigState(String uuid, Integer configState);

	@Modifying
	@Transactional
	@Query(value = "update t_camera set is_del=1 where uuid=?1 ", nativeQuery = true)
	public Integer deleteDevice(String uuid);
	
	@Modifying
	@Transactional
	@Query(value = "select uuid,is_del from t_uuid where uuid = ?1", nativeQuery = true)
	public List<String> selectUuid(String uuid);

}
